package cn.initcap.concurrency.concurrency.threadlocal;

/**
 * @author initcap
 * @date Created in 2018/6/16 AM9:19.
 */
public class RequestHolder {

    private static final ThreadLocal<Long> REQUEST_HOLDER = new ThreadLocal<>();

    public static void add(Long id) {
        REQUEST_HOLDER.set(id);
    }

    public static Long getId() {
        return REQUEST_HOLDER.get();
    }

    public static void remove() {
        REQUEST_HOLDER.remove();
    }

}
